﻿Imports HMSLibrary
Imports HMSDataLayer

Public Class PatientTestUserControl
    Implements IHMSData

    Public Property ActionMode As HMSLibrary.FormAction Implements HMSLibrary.IHMSData.ActionMode

    Public Sub AddNew() Implements HMSLibrary.IHMSData.AddNew
        HealthStatusComboBox.SelectedIndex = -1
        HeartBeatComboBox.SelectedIndex = -1
        RemarksTextBox.Text = String.Empty

        ExamDatePicker.SelectedDate = Date.Now
        ExamDatePicker.DisplayDateEnd = Date.Now
        ExamTime.Value = Date.Now
        ActionMode = FormAction.ADD
        Dim dataProvider As New MasterDataLayer()
        Dim lst As List(Of Lookups)

        lst = dataProvider.GetLookupList(LookupTypes.HealthStatus)
        HealthStatusComboBox.ItemsSource = lst
    End Sub

    Public Sub BackView() Implements HMSLibrary.IHMSData.BackView

    End Sub

    Public Function DataValidation() As Boolean Implements HMSLibrary.IHMSData.DataValidation

    End Function

    Public Sub FindData() Implements HMSLibrary.IHMSData.FindData

    End Sub

    Public Property ID As Integer Implements HMSLibrary.IHMSData.ID

    Public Sub LoadData(ByVal ID As Integer) Implements HMSLibrary.IHMSData.LoadData

    End Sub

    Public Function SaveData() As Boolean Implements HMSLibrary.IHMSData.SaveData
        Dim dataLayer As New PatientDataLayer()
        Dim obj As New PatientGeneralExmination
        obj.bpdown = DownBpTextBox.Text
        obj.bpup = UpBpTextBox.Text
        obj.examByDr = Nothing
        obj.examDate = ExamDatePicker.SelectedDate
        obj.headcircumference = HeadCircumferenceTextBox.Text
        obj.healthStatus = HealthStatusComboBox.SelectedValue
        obj.heartRate = HeartRateTextBox.Text
        obj.height = HeightTextBox.Text
        obj.notes = RemarksTextBox.Text
        obj.patientId = ID
        obj.pulse = PulseTextBox.Text
        obj.respiration = RespirationTextBox.Text
        obj.temperature = TemperatureTextBox.Text
        obj.weight = WeightTextBox.Text
    End Function

    Public Sub New()

        ' This call is required by the designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.

    End Sub
End Class
